package com.example.swagger.controller;

import com.example.swagger.config.JsonResult;
import com.example.swagger.entity.*;
import com.example.swagger.service.UserService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@Controller
public class LoginController {

    @Autowired
    private UserService userService;

    @ApiOperation(value = "用户登录", notes = "根据UserId对象登录", tags = {"用户模块"})
    @ApiImplicitParam(name = "user", value = "用户详细实体user", required = true, dataType = "User")
    @RequestMapping(value = "loginIn", method = RequestMethod.POST)
    @ResponseBody
    public JsonResult<User> loginInUser(@RequestBody Member user) {

        System.out.println(user.toString());
        return new JsonResult(user.toString());
    }

    @ApiOperation(value = "用户登录", notes = "根据UserId对象登录", tags = {"用户模块"})
    @ApiImplicitParam(name = "user", value = "用户详细实体user", required = true, dataType = "User")
    @RequestMapping(value = "loginIn/member", method = RequestMethod.POST)
    @ResponseBody
    public JsonResult<Team> loginInMember(@RequestBody Team user) {

        System.out.println(user.toString());
        return new JsonResult(user.toString());
    }

    @ApiOperation(value = "用户登录", notes = "根据UserId对象登录", tags = {"用户模块"})
    @ApiImplicitParam(name = "user", value = "用户详细实体user", required = true, dataType = "User")
    @RequestMapping(value = "loginIn/memberUser", method = RequestMethod.POST)
    @ResponseBody
    public JsonResult<String> loginInMemberAndUser(@RequestBody User user, @RequestParam("token") String token) {

        System.out.println(user.toString());

        System.out.println(token);

        return new JsonResult(token + "《《《" + user.toString());
    }

    @ApiOperation(value = "用户登录", notes = "根据UserId对象登录", tags = {"用户模块"})
    @ApiImplicitParam(name = "ApiRequestUserEntity", value = "用户详细实体ApiRequestUserEntity", required = true, dataType = "ApiRequestUserEntity")
    @RequestMapping(value = "loginOn", method = RequestMethod.POST)
    @ResponseBody
    public JsonResult<ApiRequestUserDataEntity> loginOn(@RequestBody ApiRequestUserDataEntity user) {

        System.out.println(user.toString());

        return new JsonResult(user);
    }
}
